//===============================================================================
// Microsoft Architecture Strategy Team
// LitwareHR - SaaS Sample Application
//===============================================================================
// Copyright  Microsoft Corporation.  All rights reserved.
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY
// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT
// LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
// FITNESS FOR A PARTICULAR PURPOSE.
//===============================================================================
// The example companies, organizations, products, domain names,
// e-mail addresses, logos, people, places, and events depicted
// herein are fictitious.  No association with any real company,
// organization, product, domain name, email address, logo, person,
// places, or events is intended or should be inferred.
//===============================================================================


using System;
using System.Collections.Generic;
using System.Text;

namespace LitwareHR.Recruiting.Contract
{
    public enum LogicalOperator : int
    {
        Equal = 0,
        NotEqual = 1,
        LessThan = 2,        
        GreaterThan = 3,
        LessOrEqualThan = 4,
        GreaterOrEqualThan = 5
    }

    public enum LogicalConnector : int
    {
        And = 0,
        Or = 1
    }

    public enum PropertyType : int
    { 
        String = 0,
        Boolean = 1,
        DateTime = 2
    }

    [Serializable]
    public class PropertyFilter
    {
        public PropertyFilter(string name, PropertyType type, LogicalOperator op, string value, LogicalConnector logical)
        {
            this.Name = name;
            this.PropertyType = type;
            this.Operator = op;
            this.Value = value;
            this.LogicalConnector = logical;
        }

        public PropertyFilter(string name, PropertyType type, LogicalOperator op, object value, LogicalConnector logical)
            : this(name, type, op, value.ToString(), logical)
        {
        }

        public PropertyFilter()
        {
        }

        private PropertyType propertyType;
        public PropertyType PropertyType 
        {
            get
            {
                return propertyType;
            }
            set
            {
                propertyType = value;
            }
        }

        private string name;
        public string Name 
        {
            get
            {
                return name;
            }
            set
            {
                name = value;
            }
        }

        private string valuePropertyFilter;
        public string Value 
        {
            get
            {
                return valuePropertyFilter;
            }
            set
            {
                valuePropertyFilter = value;
            }
        }

        private LogicalOperator operatorPropertyFilter;
        public LogicalOperator Operator 
        {
            get
            {
                return operatorPropertyFilter;
            }
            set
            {
                operatorPropertyFilter = value;
            }
        }

        private LogicalConnector logicalConnector;
        public LogicalConnector LogicalConnector 
        {
            get
            {
                return logicalConnector;
            }
            set
            {
                logicalConnector = value;
            }
        }

        private PropertyFilter[] subFilters;
        public PropertyFilter[] SubFilters 
        {
            get
            {
                return subFilters;
            }
            set
            {
                subFilters = value;
            }
        }

        private LogicalConnector logicalConnectorSubFilter;
        public LogicalConnector LogicalConnectorSubFilter 
        {
            get
            {
                return logicalConnectorSubFilter;
            }
            set
            {
                logicalConnectorSubFilter = value;
            }
        }

        public void SetSubFilters(PropertyFilter[] subFilters, LogicalConnector logical)
        {
            this.SubFilters = subFilters;
            this.LogicalConnectorSubFilter = logical;
        }
    }
}
